package com.platform.api.bzproject.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.platform.api.bzproject.model.BalanceRecord;
import com.platform.api.bzproject.model.SettlementDaysBill;
import com.platform.api.bzproject.dao.SettlementDaysBillMapper;
import com.platform.api.bzproject.service.ISettlementDaysBillService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.core.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户每日结算账单 服务实现类
 * </p>
 *
 * @author guoshao
 * @since 2022-02-26
 */
@Service
public class SettlementDaysBillServiceImpl extends ServiceImpl<SettlementDaysBillMapper, SettlementDaysBill> implements ISettlementDaysBillService {

    @Autowired
    private SettlementDaysBillMapper settlementDaysBillMapper;

    @Override
    public PageInfo<SettlementDaysBill> selectSettlementDays(SettlementDaysBill settlementDaysBill, Integer offset) {
        Integer pageNum = 1;
        if(offset > 0){
            pageNum = (offset / Constant.PAGESIZE) + 1;
        }

        PageHelper.startPage(pageNum, Constant.PAGESIZE);

        PageInfo<SettlementDaysBill> pageInfo = new PageInfo<>(settlementDaysBillMapper.selectSettlementDays(settlementDaysBill));
        return pageInfo;
    }
}
